package client.comm.baoding.adapter.main

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import client.comm.baoding.fragment.TabOneFragment
import client.comm.baoding.fragment.TabWhiteFragment

class HomePageAdapter(fm: FragmentManager) : FragmentStatePagerAdapter(fm) {

    private val fragments: Array<Fragment?> by lazy {
        arrayOfNulls(1)
    }

    private val fragmentTitles: Array<String?> by lazy {
        arrayOf("首页","翔伦益鑫自营")
    }

    override fun getItem(position: Int): Fragment {
        if (position == 0) {
            fragments[0] = TabOneFragment()
        } else {
            fragments[position] = TabWhiteFragment()
        }
        /*else {
            fragments[position] = AuctionSubscribeOneFragment()
        }*/
        return fragments[position]!!
    }

    override fun getCount(): Int {
        return fragments.size
    }

    override fun getPageTitle(position: Int): CharSequence? {
        return fragmentTitles[position]
    }

    override fun getItemPosition(`object`: Any): Int {
        return POSITION_NONE
    }

}